/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.vfi.be;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "VFI_CHEQUE")
@NamedQueries({@NamedQuery(name = "Cheque.findAll", query = "SELECT c FROM Cheque c"), @NamedQuery(name = "Cheque.findByIdCheque", query = "SELECT c FROM Cheque c WHERE c.idCheque = :idCheque"), @NamedQuery(name = "Cheque.findByNroCheque", query = "SELECT c FROM Cheque c WHERE c.nroCheque = :nroCheque"), @NamedQuery(name = "Cheque.findByMonto", query = "SELECT c FROM Cheque c WHERE c.monto = :monto")})
public class Cheque implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CHEQUE", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idCheque;
    @Basic(optional = false)
    @Column(name = "NRO_CHEQUE", nullable = false, length = 50)
    private String nroCheque;
    @Basic(optional = false)
    @Column(name = "MONTO", nullable = false, precision = 18, scale = 2)
    private BigDecimal monto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fidPltCheque", fetch = FetchType.LAZY)
    private List<TranFinanciera> tranFinancieraList;

    public Cheque() {
    }

    public Cheque(Long idCheque) {
        this.idCheque = idCheque;
    }

    public Cheque(Long idCheque, String nroCheque, BigDecimal monto) {
        this.idCheque = idCheque;
        this.nroCheque = nroCheque;
        this.monto = monto;
    }

    public Long getIdCheque() {
        return idCheque;
    }

    public void setIdCheque(Long idCheque) {
        this.idCheque = idCheque;
    }

    public String getNroCheque() {
        return nroCheque;
    }

    public void setNroCheque(String nroCheque) {
        this.nroCheque = nroCheque;
    }

    public BigDecimal getMonto() {
        return monto;
    }

    public void setMonto(BigDecimal monto) {
        this.monto = monto;
    }

    public List<TranFinanciera> getTranFinancieraList() {
        return tranFinancieraList;
    }

    public void setTranFinancieraList(List<TranFinanciera> tranFinancieraList) {
        this.tranFinancieraList = tranFinancieraList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCheque != null ? idCheque.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cheque)) {
            return false;
        }
        Cheque other = (Cheque) object;
        if ((this.idCheque == null && other.idCheque != null) || (this.idCheque != null && !this.idCheque.equals(other.idCheque))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vfi.be.Cheque[idCheque=" + idCheque + "]";
    }

}
